#coding=utf-8
#Eriocheir sinensis '中华绒螯蟹'
#从genebank 下载gi号

import time
from Bio import Entrez
term = 'Eriocheir sinensis'
term = '(Eriocheir sinensis) AND "Eriocheir sinensis"[porgn:__txid95602]'
db = 'nucest'

step = 500

Entrez.email = 'xiaojay@gmail.com'

handle = Entrez.esearch(db=db, term=term)
record = Entrez.read(handle)
count = int(record["Count"])
print count
n = count/step + 1
#print n
for i in range(n):
  #print i
  handle = Entrez.esearch(db=db, term=term, retstart=i*step, retmax=step)
  record = Entrez.read(handle)
  for id_ in record["IdList"]:
    print id_
  time.sleep(5)
    

